package com.huizu.project.controller;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.huizu.project.config.TerAspect;
import com.huizu.project.utils.TokenUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProUserDc;
import com.huizu.project.service.IProUserDcService;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 督促信息Controller
 * 
 * @author zhangmx
 * @date 2024-06-05
 */
@RestController
@RequestMapping("/project/prouserdc")
public class ProUserDcController extends BaseController
{
    @Autowired
    private IProUserDcService proUserDcService;

    /**
     * 查询督促信息列表
     */
    @PreAuthorize("@ss.hasPermi('project:prouserdc:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProUserDc proUserDc)
    {
        startPage();
        List<ProUserDc> list = proUserDcService.selectProUserDcList(proUserDc);
        return getDataTable(list);
    }

    /**
     * 导出督促信息列表
     */
    @PreAuthorize("@ss.hasPermi('project:prouserdc:export')")
    @Log(title = "督促信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProUserDc proUserDc)
    {
        List<ProUserDc> list = proUserDcService.selectProUserDcList(proUserDc);
        ExcelUtil<ProUserDc> util = new ExcelUtil<ProUserDc>(ProUserDc.class);
        util.exportExcel(response, list, "督促信息数据");
    }

    /**
     * 获取督促信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:prouserdc:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(proUserDcService.selectProUserDcById(id));
    }

    /**
     * 新增督促信息
     */
    @PreAuthorize("@ss.hasPermi('project:prouserdc:add')")
    @Log(title = "督促信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProUserDc proUserDc)
    {
        return toAjax(proUserDcService.insertProUserDc(proUserDc));
    }

    /**
     * 修改督促信息
     */
    @PreAuthorize("@ss.hasPermi('project:prouserdc:edit')")
    @Log(title = "督促信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProUserDc proUserDc)
    {
        return toAjax(proUserDcService.updateProUserDc(proUserDc));
    }

    /**
     * 删除督促信息
     */
    @PreAuthorize("@ss.hasPermi('project:prouserdc:remove')")
    @Log(title = "督促信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(proUserDcService.deleteProUserDcByIds(ids));
    }

    /**
     * 新增督促信息
     */
    @PostMapping("/addDcList")
    public AjaxResult addDcList(@RequestBody Map<String,Object> proUserDc)
    {
        return proUserDcService.dcStList(proUserDc);
    }
}
